use std::f32::consts::PI;

use glam::Vec2;
use rand::Rng;

pub struct Walker {
    location: Vec2
}

impl Walker {
    pub fn new(location: Vec2) -> Walker{
        Walker{location : location}
    }
    pub fn get_location(& self) -> Vec2 {
        self.location
    }
    pub fn move_to(&mut self, target: Vec2) {
        let direction = (target-self.location).normalize();
        self.location += direction;
    }
    pub fn move_random(&mut self) {
        let mut rng = rand::thread_rng();
        
        let fi: f32 = 2.0*PI*(rng.gen::<f32>());
        self.location.x += fi.cos();
        self.location.y += fi.sin();
    }
}